
<!doctype html>
<html class="no-js">
<#include "../../common/header.ftl">
<script	src="${basePath}/js/banner/edit.js?v=201711021700"></script>
<head>
<meta charset="UTF-8">
<title>编辑轮播图</title>
<style>
	.foot{
		position: absolute;
		left: 10%;
		top: 90%;
	}
	.lable_text{
		padding:0px 8px;
	}
	.hide{
		display:none;
	}
	.readonly-input{
		background-color: #e2e2e2;
	}
	.left{
		float:left;
	    width: 45%;
	}
	.answer-tips{
		color:red;
	}
</style>
</head>
<body>
<div style="min-height: 80%; min-width: 90%; margin: 20px 20px;">
	<div style="width:80%;">
		<form class="layui-form layui-form-pane">
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:112px;">展示页面*</label>
				<div class="layui-input-block">
					<select name="showMethod" lay-filter="showMethod" >
				        <option value="">请选择展示页面</option>
				        <option value="1" <#if banner.showMethod?? && banner.showMethod==1>selected</#if>>首页</option>
				        <option value="2" <#if banner.showMethod?? && banner.showMethod==2>selected</#if>>发现页</option>
				     </select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:112px;">标题*</label>
				<div class="layui-input-block">
						<input type="text"	name="title" required="" lay-verify="required"
						placeholder="请输入标题" value="${banner.title!}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:112px;">链接地址</label>
				<div class="layui-input-block">
						<input type="text"	name="url" required="" lay-verify="required"
						placeholder="例：http://www.zimmur.com" value="${banner.url!}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:112px;">排序顺序*</label>
				<div class="layui-input-block">
						<input type="text"	name="orderNo" required="" lay-verify="required"
						placeholder="越大越靠前" value="${banner.orderNo!}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="width:112px;">图片*</label>
				<div class="layui-input-block">
					<div class="site-upload">
						<#if banner.imageUrl??>
							<img id="imageUrl" data-img="${banner.imageUrl}" src="${imgUrl+banner.imageUrl}" style="width:375px;height:200px;" >
						<#else>
							<img id="imageUrl" data-img="" src="${basePath}/images/default_goods.jpg" style="width:375px;height:200px;" >
						</#if>
						<div class="site-upbar">
							<div class="layui-box">
								<form target="layui-upload-iframe" method="get" key="set-mine" enctype="multipart/form-data" action="#">
									 <input type="file" name="files" data-type="one" class="layui-upload-file" >
								</form>
							</div>
							<p class="am-form-help">图片尺寸： 宽&nbsp;&nbsp;375PX 高&nbsp;&nbsp;200PX</p>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div class="foot">
		<button type="button" class="layui-btn layui-btn-normal"
			id="save-button">
			<i class="layui-icon">&#xe605;</i>保存
		</button>
		<button type="button" class="layui-btn layui-btn-normal"
			id="close-button">
			<i class="layui-icon">&#x1006;</i>关闭
		</button>
	</div>
</div>
</body>
<script type="text/javascript">
	var basePath = "${basePath}";
	var imgUrl = "${imgUrl}";
	var init={
	 	bannerId:"${banner.id!}"
	}
	layui.use(['form','layer','upload'], function() {
		var form = layui.form();
		var layer = layui.layer;
		layui.upload({
    		url: basePath+'/restful/file/upload.shtml', //上传接口
    		ext: 'jpg|png|bmp|jpeg',
    		method: 'post',
    		success: function(res,input){ //上传成功后的回调
    			console.log(res);
			    if(res.code=="000000"){
				 	var id=res.data[0].id;
				    var src=imgUrl+id;
				    $("#imageUrl").attr("src",src);
				    $("#imageUrl").attr("data-img",id);
			    }else{
			      layer.msg("上传失败")
			    }
			}
  		});
	});
</script>
</html>
